<?
include('conn.php');

if (($handle = fopen("invoice.csv", "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
        $num = count($data);
        echo "<p> $num fields in line $row: <br /></p>\n";
        $row++;
        for ($c=0; $c < $num; $c++) {
            echo $data[$c] . "<br />\n";
        }
		
		
		
		
		$qry1 = 'insert into csvtable(`Bkng Date`,`YT Number` 	,	`Pax Name` 	,	`Basic`	,	`Net Payable` ,		`Agent`	,	`entrydt`, 	`processed`) values(;'.$data[0].';,'.$data[1].',;'.$data[4].';,'.$data[10].','.$data[19].',;'.$data[21].';,CURDATE(),0)';
		 $qry1 = str_replace(";", "'", $qry1);
		echo $qry1;
		$qry = mysql_query($qry1);
		echo $qry;
    }
    fclose($handle);
}


//$qry = mysql_query($qry1);


echo $qry;


?>